Skip to content

feat(stovepipe): report last-green freshness - #572

Closed
mnoah1 wants to merge 6 commits into
mainfrom
mnoah1/stovepipe-lastgreen-freshness
Closed

feat(stovepipe): report last-green freshness#572
mnoah1 wants to merge 6 commits into
mainfrom
mnoah1/stovepipe-lastgreen-freshness

Conversation

@mnoah1

@mnoah1 mnoah1 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Support periodic observations of queue health via a Reporter interface. This can be called as part of other tasks that we know will alter queue state (wired here into the record step), and also triggered separately on a periodic schedule.

SourceControl will provide one extra method to provide the timestamp of the latest green commit - this will give us a real time gauge of how much time has elapsed since the last commit was marked green.

Since this is a real time observation of current state, and not a collection of observations, a histogram does not make sense for this use case - updated docs to clarify when to use gauge vs. histogram.

Test Plan

  • Deploy with this change (and corresponding source control changes), add query for this change

Callers gate deployments on a queue's last-known-green commit, so its age is
the staleness of the newest thing they are allowed to ship. A queue whose green
bookmark stops advancing looks healthy from the pipeline's perspective —
nothing is failing — while the answer it serves silently ages, and today
nothing makes that visible.

Add an observability extension seam alongside the existing ones: a Reporter
bound to a single queue by its Factory, whose Report emits one sample of that
queue's current state. Reporting is best-effort by contract — Report returns
nothing, because an observation that cannot be made must never change what the
pipeline records or decides — so implementations emit their own error metrics
and callers can defer a report without handling a result.

The lastgreen implementation reports that age as a gauge, the first in the
repo: the answer is the latest observation rather than a distribution, which
the platform/metrics guidance now admits alongside a NamedGauge helper. Dating
the bookmarked commit needs a timestamp SourceControl did not expose, so
ChangeInfo joins that contract, returning immutable metadata about the commit a
URI names rather than about the ref that points at it. The record stage, which
owns the bookmark, reports after handling each message.
@mnoah1
mnoah1 force-pushed the mnoah1/stovepipe-lastgreen-freshness branch from b282822 to 029d68a Compare August 11, 2026 22:39
@mnoah1
mnoah1 marked this pull request as ready for review August 11, 2026 22:46
@mnoah1
mnoah1 requested review from a team, behinddwalls and sbalabanov as code owners August 11, 2026 22:46
Comment thread stovepipe/extension/observability/observability.go Outdated
mnoah1 and others added 3 commits August 12, 2026 15:41
The Reporter interface, its Factory, and the lastgreen implementation had one
implementation and one caller, and abstracted no technology choice: storage and
source control were already extensions, and tally arrives as an injected scope.
What remained was domain logic, which moves into the periodicmetrics controller.
Add a periodicmetrics queue stage that emits the age of a queue's
last-known-green commit as a gauge. It is the one stage no other stage feeds:
the deployment publishes a PeriodicMetrics message on a schedule, because the
health it reports degrades while the pipeline is idle and so cannot be observed
from pipeline activity alone.

A failed observation acks and is counted with the step that failed; only a
message violating the payload contract is rejected, so a persistently
unresolvable queue cannot fill the dead-letter queue at the publishing rate.

record no longer reports, which takes a source-control call off the delivery
path of the stage that owns durable validation state.
@mnoah1

mnoah1 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Closing - aligned on polling for this internally.

@mnoah1 mnoah1 closed this Aug 12, 2026
behinddwalls pushed a commit to behinddwalls/submitqueue that referenced this pull request Aug 19, 2026
## Summary
Emit how long a break went undetected: when a validation build fails,
record the elapsed time from the commit timestamp of the base it
validated against, as a histogram tagged with the queue and the build
strategy. A histogram rather than a gauge because the distribution over
failures is the point — what an operator wants is how long a break
typically survives, not how long the last one did. The buckets
(`ChangeAgeBuckets`) span minutes to a month, since a break caught in
minutes and one that survived a fortnight are both ordinary
observations.

The observation lives in `buildsignal`, the stage that records the
failure. A failure is the moment a break becomes known, and an elapsed
time is only meaningful against it, so unlike the last-known-green age
in uber#572 there is no later moment to sample it from — it cannot be moved
off the delivery path onto the periodic schedule. The cost is a
source-control call on that path, so it is confined to failures, made
after the outcome is durable, and swallows every fault: a failed
observation is counted with the step that failed and never disturbs the
outcome already written.

A full build pins no base commit, so its failures have nothing to
measure from. That is the ordinary case for the strategy rather than a
fault, so those failures are counted as unmeasurable
(`detection_missing`) instead of landing in the error series.

Rebased onto the restructured uber#572, so the emits follow the same
conventions as the last-green observation there: an operation name for
what is measured rather than for the stage, `detection_errors` tagged
with the step that failed, a separate counter for "nothing to measure",
and failures logged. The source-control factory is a required
constructor dependency and wired in `service/stovepipe/server/main.go`.

## Test Plan
- `make test` — table-driven unit tests cover the measured path, the
no-baseline (full build) case, and every step that can fail to observe:
source control not resolving, `ChangeInfo` failing, an undated change,
and a change dated in the future.
- `make lint`, `make check-gazelle`, `make check-tidy`, `make build`.
- Deploy and add a query for `build_failure.time_to_detection`,
confirming `detection_errors` stays flat and `detection_missing` tracks
only full-build failures.

## Issues


## Stack
1. uber#572
1. @ uber#573
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants